package xiaopiya.robot.handler.rss.tool;

import org.gnu.stealthp.rsslib.RSSItem;


/**
 * @author Ray (ayufox@gmail.com)
 * @version 0.1
 */
public class DefaultContentItemFilter implements IContentItemFilter
{
	private String linkPre;

	public void setLinkPre(String linkPre)
	{
		this.linkPre = linkPre;
	}

	public ContentItem filter(RSSItem item)
	{
		String link = null;
		if (this.linkPre != null && item.getLink().startsWith(this.linkPre))
		{
			link = item.getLink().substring(this.linkPre.length(),
					item.getLink().length());
		} else
		{
			link = item.getLink();
		}
		return new ContentItem(item.getLink(), link, item.getTitle(), null);
	}
}
